Expose Debug API through the CLI#7133
Open
sorindumitru wants to merge 3 commits into
Open
Conversation
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
There was a problem hiding this comment.
Pull request overview
This PR exposes the existing Agent and Server Debug APIs via new CLI subcommands (debug getinfo), making it easier for operators to retrieve runtime debug information (uptime, counts, and SVID chain) without writing custom clients.
Changes:
- Add
spire-server debug getinfobacked by the server Debug gRPC API, including CLI wiring and tests. - Add
spire-agent debug getinfobacked by the agent Debug gRPC API, including OS-specific socket/named-pipe handling and tests. - Update CLI documentation and the agent sample config to surface the new debug functionality.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/spire_server.md | Documents new spire-server debug getinfo command and flags |
| doc/spire_agent.md | Documents new spire-agent debug getinfo command and flags |
| conf/agent/agent.conf | Updates sample agent config to include an Admin API socket path |
| cmd/spire-server/util/util.go | Adds NewDebugClient() to the server CLI client interface |
| cmd/spire-server/cli/debug/debug.go | Implements spire-server debug getinfo command and pretty output |
| cmd/spire-server/cli/debug/debug_posix_test.go | POSIX usage string expectations for server debug command |
| cmd/spire-server/cli/debug/debug_windows_test.go | Windows usage string expectations for server debug command |
| cmd/spire-server/cli/debug/debug_test.go | Unit tests for server debug command behavior/output |
| cmd/spire-server/cli/cli.go | Registers debug getinfo in the server CLI command map |
| cmd/spire-agent/cli/debug/debug.go | Implements spire-agent debug getinfo command and pretty output |
| cmd/spire-agent/cli/debug/debug_posix.go | POSIX socket flag/address handling for agent debug command |
| cmd/spire-agent/cli/debug/debug_windows.go | Windows named-pipe flag/address handling for agent debug command |
| cmd/spire-agent/cli/debug/debug_posix_test.go | POSIX usage + helper setup for agent debug tests |
| cmd/spire-agent/cli/debug/debug_windows_test.go | Windows usage + helper setup for agent debug tests |
| cmd/spire-agent/cli/debug/debug_test.go | Unit tests for agent debug command behavior/output |
| cmd/spire-agent/cli/cli.go | Registers debug getinfo in the agent CLI command map |
| server_address = "127.0.0.1" | ||
| server_port = "8081" | ||
| socket_path ="/tmp/spire-agent/public/api.sock" | ||
| admin_socket_path ="/tmp/spire-agent/private/admin.sock" |
Comment on lines
+390
to
+392
| Prints debug information about the agent, including uptime, last successful | ||
| sync time, cached SVID counts, and the agent's own SVID chain. | ||
|
|
Comment on lines
+93
to
+96
| env.Printf("Agent Debug Info:\n") | ||
| env.Printf(" Uptime: %s\n", (time.Duration(resp.Uptime) * time.Second).String()) | ||
| env.Printf(" Last Sync Success: %s\n", time.Unix(resp.LastSyncSuccess, 0).UTC().Format(time.RFC3339)) | ||
| env.Printf(" Cached X.509 SVIDs: %d\n", resp.CachedX509SvidsCount) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request check list
Affected functionality
Agent and server CLIs
Description of change
The debug API is now exposed through the CLI, making it easier to use.